package gyn.fgsl.adapters;

import gyn.fgsl.R;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class GridViewOrganizadoresAdapter extends ArrayAdapter<Pair<Integer, String> > {
	private LayoutInflater inflater;
	private int layoutResId;
	private ArrayList<Pair<Integer, String> > data;
	
	public GridViewOrganizadoresAdapter(Context context, int layoutResId, ArrayList<Pair<Integer, String> >data) {
		super(context, layoutResId, data);
		this.data = data;
		this.layoutResId = layoutResId;
		inflater = ((Activity) context).getLayoutInflater();
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent){
		if(convertView == null){
			convertView = inflater.inflate(R.layout.organizadores_item, parent, false);
		}
		((ImageView) convertView.findViewById(R.id.organizadoresItemImageView)).setImageResource(data.get(position).first);
		((TextView) convertView.findViewById(R.id.organizadoresItemTextView)).setText(data.get(position).second);
		
		return convertView;
	}
}
